import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/api/auth/login',
    method: 'post',
    data
  })
}

export function register(data) {
  return request({
    url: '/api/auth/register',
    method: 'post',
    data
  })
}

export function logout(userId) {
  console.log('Calling logout API for user:', userId)
  return request({
    url: `/api/auth/logout/${userId}`,
    method: 'post'
  }).then(response => {
    console.log('Logout API response:', response)
    return response
  })
}

export function getOnlineUsers() {
  return request({
    url: '/api/auth/online/users',
    method: 'get'
  })
}

export function getOnlineUserCount() {
  return request({
    url: '/api/auth/online/count',
    method: 'get'
  })
} 